import re

def desensitize_phone(phone):
    """对手机号进行脱敏处理"""
    if re.match(r'^1[3-9]\d{9}$', phone):
        return phone[:3] + '****' + phone[-4:]
    else:
        return phone  # 如果格式不正确，返回原值

def desensitize_id_card(id_card):
    """对身份证号进行脱敏处理"""
    if len(id_card) == 18:
        return id_card[:6] + '********' + id_card[-4:]
    elif len(id_card) == 15:
        return id_card[:6] + '******' + id_card[-3:]
    else:
        return id_card  # 如果格式不正确，返回原值

def desensitize_address(address):
    """对地址进行脱敏处理"""
    # 假设地址格式为“省 市 区 详细地址”，隐藏区和详细地址
    parts = address.split()
    if len(parts) > 2:
        return ' '.join(parts[:2]) + ' ****'
    else:
        return address  # 如果格式不正确，返回原值

def desensitize_name(name):
    """对姓名进行脱敏处理，只保留首字"""
    if len(name) > 1:
        return name[0] + '*' * (len(name) - 1)
    else:
        return name  # 如果姓名只有一个字，返回原值

# 手动输入敏感信息
name = input("请输入姓名：")
phone = input("请输入手机号：")
id_card = input("请输入身份证号：")
address = input("请输入地址：")

# 对输入的敏感信息进行脱敏处理
desensitized_name = desensitize_name(name)
desensitized_phone = desensitize_phone(phone)
desensitized_id_card = desensitize_id_card(id_card)
desensitized_address = desensitize_address(address)

# 输出脱敏后的信息
print("脱敏后的信息：")
print(f"姓名：{desensitized_name}")
print(f"手机号：{desensitized_phone}")
print(f"身份证号：{desensitized_id_card}")
print(f"地址：{desensitized_address}")